<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>国家电网售电业务佣金估算</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f4f4f9;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
        }

       .container {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 90%;
            max-width: 400px;
        }

        h2 {
            text-align: center;
            color: #333;
        }

        label {
            display: block;
            margin-bottom: 5px;
            color: #666;
        }

        input[type="number"] {
            width: 100%;
            padding: 10px;
            margin-bottom: 15px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }

        button {
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-weight: bold;
        }

       .calculate-btn {
            background-color: #28a745;
            color: white;
            margin-right: 10px;
        }

       .calculate-btn:hover {
            background-color: #218838;
        }

       .reset-btn {
            background-color: #dc3545;
            color: white;
        }

       .reset-btn:hover {
            background-color: #c82333;
        }

        p#result {
            margin-top: 20px;
            font-size: 18px;
        }

       .highlight {
            color: #007bff;
            font-weight: bold;
        }

       .tip {
            font-size: 12px;
            color: #999;
            margin-bottom: 10px;
        }

       .warm-tip {
            font-size: 12px;
            color: #666;
            margin-top: 20px;
            border-top: 1px solid #eee;
            padding-top: 10px;
        }
    </style>
</head>

<body>
    <div class="container">
        <h2>国家电网售电业务佣金估算</h2>
        <div class="tip">
            提成比例说明：<br>
            - 月用电度数 ≤ 10 万，提成比例 0.70<br>
            - 10 万 < 月用电度数 ≤ 50 万，提成比例 0.75<br>
            - 50 万 < 月用电度数 ≤ 200 万，提成比例 0.80<br>
            - 月用电度数 > 200 万，提成比例 0.85
        </div>
        <label for="monthlyDegree">请输入月用电度数（正整数）：</label>
        <input type="number" id="monthlyDegree" placeholder="输入月用电度数" min="1">
        <button class="calculate-btn" onclick="calculate()">计算结果</button>
        <button class="reset-btn" onclick="resetForm()">重置</button>
        <p id="result"></p>
        <div class="warm-tip">
            目前供电利差是按照 0.02 元进行估算的，也就是说给客户省的越多，这个利差就越小，最终保障利差不为 0 即可。因为佣金数额，还取决于客户的用电度数，如果客户的用电量每个月 500 万度，按照 0.001（1 厘）的利差乘以 500 万，最后每个月可获得的佣金也相当可观，估算大致在几千元。
        </div>
    </div>

    <script>
        const POWER_SUPPLY_SPREAD = 0.02;
        const CHANNEL_LEVEL = 0.4;
        const TIER_1 = 100000;
        const TIER_2 = 500000;
        const TIER_3 = 2000000;

        function calculate() {
            const monthlyDegree = parseInt(document.getElementById('monthlyDegree').value);
            let commissionRate;

            if (monthlyDegree <= TIER_1) {
                commissionRate = 0.70;
            } else if (monthlyDegree <= TIER_2) {
                commissionRate = 0.75;
            } else if (monthlyDegree <= TIER_3) {
                commissionRate = 0.80;
            } else {
                commissionRate = 0.85;
            }

            if (!isNaN(monthlyDegree) && monthlyDegree > 0) {
                const result = monthlyDegree * POWER_SUPPLY_SPREAD * CHANNEL_LEVEL * commissionRate;
                const formattedResult = result.toFixed(2);
                document.getElementById('result').innerHTML = `给客户省电同时能获得国家电网返佣总额（元/月）：<span class="highlight">${formattedResult}</span>`;
            } else {
                document.getElementById('result').innerHTML = "请输入有效的正整数月用电度数";
            }
        }

        function resetForm() {
            document.getElementById('monthlyDegree').value = '';
            document.getElementById('result').innerHTML = '';
        }
    </script>
</body>

</html>